<!--确认订单-->
<template>
  <view class="comfire_order">
    <onlineService></onlineService>
    <navBar v-if="isShowCustomNavBar" :navbarData.sync="navbarData"></navBar>
    <loading :showLoaded.sync="showLoaded"></loading>
    <view class="address">
      <view class="empty_address" v-if="drawAddInfo == '' || Object.keys(drawAddInfo).length <= 0">
        <view class="title">网络异常，请重新加载</view>
      </view>
      <view class="address_info" v-else>
        <image class="location_icon" :src="locationIconImg"></image>
        <view class="title title_info">
          <view class="user_name">
            {{ drawAddInfo.receiverName }}
          </view>
          <view class="phone_style">
            {{ drawAddInfo.receiverMobile }}
          </view>
          <view class="phone_style">
            {{ drawAddInfo.receiverState }} {{ drawAddInfo.receiverCity }} {{ drawAddInfo.receiverDistrict }}
            {{drawAddInfo.receiverTown}}
            {{ drawAddInfo.receiverAddress }}
          </view>
        </view>
      </view>
    </view>

    <!-- 订单商品 -->
    <view class="goodsList">
      <block v-for="(item, index) in list" :key="index" v-if="item.isGift !== 1">
        <view class="list_box">
          <view class="goods-info">
            <navigator
              :url="'/pages/item/item?id=' + item.itemId + '&valueId=' + item.skuProperties[0].valueId + '&valueName=' + item.skuProperties[0].valueName"
              hover-class="none">
              <view class="img-box">
                <image :src="item.hdlpImageUrl ? item.hdlpImageUrl : item.skuImageUrl" class="img" />
              </view>
            </navigator>
            <view class="text-box">
              <navigator
                :url="'/pages/item/item?id=' + item.itemId + '&valueId=' + item.skuProperties[0].valueId + '&valueName=' + item.skuProperties[0].valueName"
                hover-class="none">
                <view class="goods-title">{{ item.itemName }}</view>
              </navigator>
              <view class="lable">
                <view class="bo-label">
                  {{ item.skuProperties[0].valueName }}
                </view>
              </view>
              <view class="bottomBox">
                <view class="buy-number">{{item.qty}}x</view>
                <view class="font_24 color_000000">
                  <text class="mark font_24 color_000000">¥</text>
                  {{ filterChecked.moneyFormat(item.price / 1, 2) }}
                </view>
              </view>
            </view>
          </view>
        </view>
      </block>
      <!-- 运费 -->
      <view class="distribution" v-if="drawAddInfo && drawAddInfo.customerAddressId">
        <span class="font_24 color_000000">配送服务</span>
        <span class="font_24 color_757575">{{ orderDetail.postFee == 0 ? '免费配送' : '¥ ' + filterChecked.moneyFormat(orderDetail.postFee, 2) }}</span>
      </view>
    </view>
    <!-- 订单备注 -->
    <view class="order-remarks" v-if="showCheckoutRemark">
      <view class="title">买家备注</view>
      <view class="input">
        <input maxlength="100" type="text" @input="inputRemarks" @confirm="setRemarks" placeholder="选填" placeholder-style="color:#a4a4a4;opcity:0.5;" />
      </view>
    </view>


    <!-- 温馨提示2 -->
    <view class="tip_box" :class="showOrderDetails ? 'tip_box_show':'tip_box_hidden'">
      <view class="tip_inner">
        <text class="tip_icon color_757575 font_24">·</text>
        <text class="tip_text color_757575 font_24">个别区域受物流及其他政策暂停/暂缓派送的，以实际揽件时系统提示为准。</text>
      </view>
      <view class="tip_inner">
        <text class="tip_icon color_757575 font_24">·</text>
        <text class="tip_text color_757575 font_24">依据法律规定及公司政策，18周岁以下人士不得购买此类产品</text>
      </view>
      <view class="tip_inner">
        <text class="tip_icon color_757575 font_24">·</text>
        <text class="tip_text color_757575 font_24">您了解并确认：您系基于生活消费需要而购买、使用和接受本店的商品和服务。在您随后提交订单并支付相关款项后，您将和我们订立相关商品购买合同，您提交的订单方可进入发货环节；未及时付款将导致您的购买资格被取消。如果您违反了以下任意内容：</text>
      </view>
      <view class="tip-text2 color_757575 font_24">
        a. <text style="padding-left: 20rpx;">法律法规</text>
      </view>
      <view class="tip-text2 color_757575 font_24">
        b.<text @click.stop="shoppingInstructions" class="check-dec">《THE MACALLAN麦卡伦线上精品店购物须知》</text>
      </view>
      <view class="tip-text2 color_757575 font_24">
        c.<text @click.stop="skipRule" class="check-dec">《THE MACALLAN麦卡伦线上精品店“不凡甄选” 活动规则》</text>
      </view>
      <view class="tip-text2 color_757575 font_24">
        d. <text style="padding-left: 20rpx;">采用任何方式规避商品限购数量限制</text>
      </view>
      <view class="tip_inner">
        <text class="tip_icon color_757575 font_24">·</text>
        <text class="tip_text color_757575 font_24">我们有权基于前述情形自行判断并拒绝向您提供小程序服务、商品或购买资格或采取其他合理措施。相关政策详见：</text>
      </view>
      <view class="tip-text2 color_757575 font_24">
        a.<text @click.stop="shoppingInstructions" class="check-dec">《THE MACALLAN麦卡伦线上精品店购物须知》</text>
      </view>
      <view class="tip-text2 color_757575 font_24">
        b.<text @click.stop="skipRule" class="check-dec">《THE MACALLAN麦卡伦线上精品店“不凡甄选” 活动规则》</text>或咨询在线客服。
      </view>
    </view>

    <!-- 底部合计区域 -->
    <view class="bottomBar">
      <!-- 协议勾选 -->
      <view class="bottom-agreement">
        <view class="agreement">
          <view class="agreement-left" @click="checkboxChange">
            <image style="width: 100%;height:100%;" :src="checked ? selectedCheckboxImg: unselectedCheckboxImg"></image>
          </view>
          <view class="agreement-right color_757575 font_24">
            我已阅读并同意
            <text @click.stop="shoppingInstructions" class="check-dec">《THE MACALLAN麦卡伦线上精品店购物须知》</text>和<text
              @click.stop="drinkingProposal" class="check-dec">《理性饮酒倡议书》</text>并确认该商品不适用七天无理由退货。
          </view>
        </view>
      </view>
      <view class="bottom_submit">
        <view class="order_value_section" :class="showOrderDetails ? 'order_show':'order_hidden'">
          <view class="order_item">
            <view class="flex_style" @click.stop="handleOpenOrderDetails">
              <text class="title">合计</text>
              <image class="arrow_top" :class="showOrderDetails ? 'arrow_hidden' : 'arrow_show'" :src="arrowRightIconImg"></image>
            </view>
            <view class="flex_style">
              <text class="mark">¥</text>
              <text class="priceNum">{{ orderDetail.payment / 1 ? filterChecked.moneyFormat(orderDetail.payment, 2) : '' }}</text>
            </view>
          </view>
          <view class="order_item">
            <text class="title2">配送</text>
            <view class="flex_style">
              <text class="mark2">¥</text>
              <text class="priceNum2">{{ orderDetail.postFee == 0 ? '0.00' : filterChecked.moneyFormat(orderDetail.postFee, 2) }}</text>
            </view>
          </view>
          <view class="order_item">
            <text class="title2">商品总价</text>
            <view class="flex_style">
              <text class="mark2">¥</text>
              <text class="priceNum2">{{ orderDetail.payment / 1 ? filterChecked.moneyFormat(orderDetail.payment, 2) : '' }}</text>
            </view>
          </view>
        </view>
        <view class="pay_box">
          <form report-submit @submit="goPays">
            <button form-type="submit" class="button type_green" :class="checked ? '' : 'no-address'">提交订单</button>
          </form>
        </view>
      </view>
    </view>

    <!-- 弹窗 -->
    <!-- <errorTip v-if="isShowNotice" v-on:clickTap="isShow" :itemName.sync="itemName"></errorTip> -->
    <errorTip v-if="isShowNotice" v-on:clickTap="isShow" :itemName.sync="itemName" :errorMessage.sync="errorMessage">
    </errorTip>

    <!-- 优惠券弹窗 -->
    <view v-if="getCoupon == 1 && usableCoupon.length > 0">
      <view class="couponItem">
        <view style="height: 25px;">
          <view class="iconfont icon-cuowu1" @click="closeCoupon"></view>
        </view>
        <view class="coucontent" v-for="(item, index) in usableCoupon" :key="index">
          <view class="cousubstance" :data-couponCode="item.couponCode" :data-ruleName="item['couponRule'].ruleName"
            @click="useCoupon">
            <h4>{{ item['couponRule'].ruleName }}</h4>
            <view class="description">{{ item['couponRule'].description }}</view>
            <view class="copRule">有效期至 {{ item['couponRule'].toDate }}</view>
          </view>
        </view>
      </view>
    </view>

    <!-- 勾选协议弹框 -->
    <view class="popBg" v-if="isAgreement">
      <view class="bg-fix"></view>
      <view class="success-pop">
        <view>
          <i class="iconfont icon-cuowu1" @click="closeBox('关闭')"></i>
          <view class="title1">
            <view class="text">该商品不支持7天无理由退换货，</view>
            <view class="text">请谨慎下单。</view>
          </view>
        </view>
        <view class="btn-bg">
          <view class="btnStyle btn1" @click.stop="closeBox('再想想')">再想想</view>
          <view class="btnStyle btn2" @click.stop="goPay">确认下单</view>
        </view>
      </view>
    </view>

    <!-- 抽签购活动规则 -->
    <view class="mask-box-2" v-if="isActivityRule" @click.stop="isActivityRule = false" @touchmove.stop.prevent catchtouchmove="true">
    	<view class="params-padding-box-3" :style="{bottom: isIpx?'414rpx':'350rpx' }" @click.stop="stopClick">
    		<image style="width: 654rpx; height: auto;" mode="widthFix" :src="ruleBoxData.title" alt="" />
    		<scroll-view style="height: 280rpx;width: 100%;" scroll-y="true">
    			<view style="display: flex;flex-direction:column; justify-content: flex-start;align-items: center;padding: 0;margin:0;font-size: 0;">
    				<block v-for="(img, i) in ruleBoxData.list" :key="describe">
    					<image style="width:100%;height:auto;" :src="img" mode="widthFix"></image>
    				</block>
    			</view>

    		</scroll-view>
    		<view @click.stop="isActivityRule = false"
    			style="position:absolute;top:15rpx;right:14rpx; width: 90rpx;height: 90rpx"></view>
    	</view>
    </view>
		<!-- 弱提示 弹窗 -->
		<toast-popup ref="toastPopup" @onToastPopupClick="onToastPopupClick"></toast-popup>
  </view>
</template>
<script module="filterChecked" lang="wxs" src="../../utils/filter.wxs"></script>
<script>
  import api from '@/api/api';
  import tip from '@/utils/tip';
  import NavBar from '../../components/common/navbar';
  import util from '@/utils/util';
  import {
    USER_SPECICAL_INFO,
    CUSTOMER_INFO,
    MERCHANT_INFO,
    ADDRESS_ID,
    CART_KEY
  } from '@/utils/constant';
  import ErrorTip from './errorTip';
  import Loading from '@/components/common/loading';
  import onlineService from '@/components/common/onlineService';
  import { requestSubscribeMessageSync, getWaitForPayTemplateId, sendWaitForPaySubscribeMessage } from "@/utils/wx-subscribe-request";

  export default {
    config: {
      navigationBarTitleText: '确认订单'
    },
    components: {
      navBar: NavBar,
      errorTip: ErrorTip,
      onlineService: onlineService,
      loading: Loading,
    },

    data() {
      return {
        isShowCustomNavBar: true,
        // 组件所需的参数
        navbarData: {
          showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
          navbarTitle: '提交订单', //导航栏 中间的标题
          hideHome: false
        },
        isShowNotice: false,
        orderDetail: {},
        list: [],
        goodsId: '',
        //卖家留言
        sellerMessage: '',
        couponMessage: '',
        discountMessage: '',
        is_exit_address: false,
        address: {},
        totalPrice: 0, //总价
        purchaseType: 1,
        operating: false,
        payType: ' ',
        payTypeChange: '',
        payTypeArr: [],
        orderId: '',
        orderCode: '',
        isShowCouponList: false,
        couponMessage: '',
        couponValue: '',
        couponShow: false,
        itemName: [],
        subscribeMessage: [],
        postFee: '',
        cartBagItems: [],
        couponValue: '',
        couponShow: false,
        itemName: [],
        showLoaded: false,
        subscribeMessage: [],
        discountFee: '',
        postFee: '',
        itemTotal: '',
        getCoupon: 0, // 是否显示可用优惠券
        couponRuleIds: '',
        usableCoupon: [], // 可用优惠券列表
        couponRuleName: '',
        giftName: '',
        errorMessage: '',
        discountsArr: [],
        imageHeight: 206,
        interval: {},
        timer: 30, //订单状态轮循查询次数
        orderRemarks: '',
        formId: '',
        showCheckoutRemark: false,
        realCartKey: '',
        cartToBuy: false,
        couponFee: 0,
        showUseCoupon: false, //  是否展示输入优惠券的文本框
        saveCoupon: '',
        errorCouponWarn: '',
        onlyFreight: false, //只含运费促销
        checked: false,
        isAgreement: false,
        identifier: 'drawRule',
        touchStartTime: '',
        drawAddressId: 0,
        addressFail: false,
        drawAddInfo: {},
        activitySelectionRecordId: '',
        activitySelectionName:'',
        nowPages: '',
        isIpx: false,
        checkOrderId: 0,
        waitForPayTemplateId: "", // 待付款订阅消息模板id
        needSendWaitForPaySubscribeMessage: false, // 是否要发送待付款订阅消息
        locationIconImg: "",
        arrowRightIconImg: "",
        unselectedCheckboxImg: "",
        selectedCheckboxImg: "",
        showOrderDetails: false,
        isActivityRule: false,
        ruleBoxData: {
        	title: 'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/Pop-ups.png',
        	list: [
        		'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_01.png',
        		'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_02.png',
        		'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_03.png',
        		'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_04.png',
        		'https://100000063-1252208446.file.myqcloud.com/images/MF-EB-P4/activity/ballot-tip/Pop-ups@2x_05.png',
        	]
        }
      };
    },
    async onLoad(option) {
      let that = this;
      const { locationSvgImg, arrowRightSvgImg,unselectedCheckboxSvgImg,selectedCheckboxSvgImg } = require('./imgs.svg.js');
      this.locationIconImg = locationSvgImg('#000');
      this.arrowRightIconImg = arrowRightSvgImg("#757575");
      this.unselectedCheckboxImg = unselectedCheckboxSvgImg();
      this.selectedCheckboxImg = selectedCheckboxSvgImg();

      that.showLoaded = true;
      let pages = getCurrentPages();
      let prevPage = pages[pages.length - 2];
      that.cartToBuy = prevPage.route == "pages/item/item" ? true : false
      if (prevPage.route == "pages/item/item") {
        that.realCartKey = uni.getStorageSync('buyNowCartKey');
      } else {
        that.realCartKey = uni.getStorageSync('cartKey');
      }
      that.realCartKey = prevPage.route == "pages/item/item" ? uni.getStorageSync('buyNowCartKey') : uni.getStorageSync(
        'cartKey')
      this.imageHeight = 136 / uni.getStorageSync('imageScaling');
      that.actualPrice = 0;
      that.totalPrice = 0;
      that.total_jf_num = 0;
      that.can_use_score = 0;
      that.deduScore = 0;
      that.deduFee = 0;
      that.jf_num = 0;
      that.reduce_fee = 0;
      that.operating = false;
      that.goodsId = option.goodsId === undefined ? '' : option.goodsId;

      this.activitySelectionRecordId = option && option.activitySelectionRecordId
      await this.getDrawInfo(option?.goodsId, option?.valueId, this.activitySelectionRecordId);

      that.setPayType();
      that.getCartList();
      // let params = JSON.parse(decodeURIComponent(option.options))
      // if (params.identifier) {
        // this.identifier = params.identifier
      // }
      // this.activitySelectionRecordId = params && params.activitySelectionRecordId
      // this.activitySelectionName = params && params.activitySelectionName
      // this.drawAddInfo = params.drawAddInfo
      that.getAddressInfo(0);
      this.sourceBind();
      that.showCheckoutRemark = getApp().globalData.showCheckoutRemark;
      this.isIpx = getApp().globalData.isIpx
    },
    onShow() {
      let that = this;
      let pages = getCurrentPages();
      //当前页面
      var currPage = pages[pages.length - 1];
      this.nowPages = currPage.route;
      getApp().cl_tracker.track('mini_program_view', {
        path: this.nowPages,
        pageName: '抽签购提交订单',
      })
      if (that.checkOrderId !== 0) {
        that.showLoaded = true
        let flagOrderId = that.checkOrderId
        that.checkOrderId = 0
        that.$commonFunction.getOrderInfo(flagOrderId).then((res) => {
          if (res.status == 'WAIT_BUYER_PAY' || res.status == 'BUYER_PART_PAYMENT') {
            uni.redirectTo({
              url: "/pages/order/list",
            });
          } else if (res.status == 'WAIT_SELLER_SEND_GOODS') {
            uni.redirectTo({
              url: '/pages/order/paySuccess?orderNo=' + flagOrderId
            });
          } else {
            uni.redirectTo({
              url: "/pages/order/list",
            });
          }
        }).catch((err) => {

        })
      }
      setTimeout(() => {
        that.$commonSensors.commonOrderView('CheckoutPageView',that.list)
      }, 2000)
    },
    methods: {
			/**
			 * 展示弱提示
			 * @param {Object} msg 文案
			 */
			handleShowTextToast(msg){
				try{
					this.$refs.toastPopup.showToast(msg);
				}catch(e){}
			},
			/**
			 * 若提示按钮点击回调
			 * @param {Object} data.type 类型：confirm确定，cancel取消
			 * @param {Object} data.callBackData 呼气弹窗时传入的数据
			 */
			onToastPopupClick(data){},
      stopClick() {
      	return false
      },
      /**
       * 查询商品 抽签购信息
       * @param {Object} itemId
       * @param {Object} valueId
       * @param {Object} activitySelectionRecordId  抽签购活动id
       */
      async getDrawInfo(itemId, valueId, activitySelectionRecordId) {
      	let customerInfo = uni.getStorageSync(CUSTOMER_INFO) || getApp().globalData.customerInfo;
      	let merchantInfo = uni.getStorageSync(MERCHANT_INFO) || getApp().globalData.merchantInfo;

      	let json = await api.getDrawInfo({
      		method: 'GET',
      		query: {
      			store_id: merchantInfo.cloudMerchantStoreId,
      			merchant_id: merchantInfo.cloudMerchantId,
      			customer_id: customerInfo ? customerInfo.customerId : '',
      			item_id: itemId,
      			value_id: valueId
      		}
      	})
      	if (json.code === 1000 && json.data) {
          const { activitySelectionRecord, activitySelectionName } = json.data;
          if(activitySelectionRecord && activitySelectionRecord.activitySelectionRecordId == activitySelectionRecordId){
            this.drawAddInfo = activitySelectionRecord.customerAddress;
            this.activitySelectionName = activitySelectionName;
          }
        }
      },
      //  合计 展开折叠动画
      handleOpenOrderDetails(){
        this.showOrderDetails = !this.showOrderDetails;
      },
      // 购物须知
      shoppingInstructions() {
        uni.navigateTo({
          url: '/pages/utcms/utcms?uttype=shoppingInstructions'
        })
      },
      skipRule() {
        this.isActivityRule = true;
        // let url = `/pages/draw/drawRule?identifier=${this.identifier}`
        // uni.navigateTo({
        //   url: url
        // })
      },
      // 饮酒倡议书
      drinkingProposal() {
        uni.navigateTo({
          url: '/pages/utcms/utcms?uttype=drinkingProposal'
        })
      },
      // 关闭提交订单二次弹框
      closeBox(btnName) {
        let that = this
        that.isAgreement = false
        that.trackOrderConfirm('再想想')
        that.$commonSensors.popupEvent('PopupClick', {'popup_type' : '购买', 'popup_name': '确认提交订单弹窗', 'button_name': btnName ? btnName : '再想想'})
      },

      // 确认下单
      confirmOrder() {
        let that = this
      },
      // 协议勾选
      checkboxChange() {
        this.checked = !this.checked;
      },

      inputRemarks(e) {
        let that = this;
        that.orderRemarks = e.detail.value;
      },
      /**
       * @param {Object} value
       * @param {Object} type 输入备注的类型 可传input，done
       */
      async setRemarks(text, type) {
        let that = this;
        const accountInfo = uni.getAccountInfoSync()
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        let merchantInfo = uni.getStorageSync(MERCHANT_INFO);
        let inputValue = '';
        if (type == 'input') {
          inputValue = text;
        } else {
          inputValue = text.detail.value;
        }

        if (inputValue !== '' && inputValue !== undefined) {
          // let paramsStr = '?content=' + inputValue + '&store_id=' + merchantInfo.cloudMerchantStoreId;
          let content = inputValue;
          let customerInfo = uni.getStorageSync('customerInfo') || getApp().globalData.customerInfo;
          let appId = customerInfo.appId
          const checkText = await api.checkText({
            method: 'POST',
            header: {
              'Content-Type': 'application/json',
            },
            query: {
              content: content
            }
          }, appId);
          // if (checkText.code == 0) {
          if (checkText.code == 1000) {
            if (type == 'input') {
              that.testAddress(0, that.formId);
            }
            const resultJson = await api.setOrderRemarks({
              method: 'PUT',
              header: {
                'jwt': jwt
              },
              query: {
                buyerRemark: inputValue
              }
            }, that.realCartKey);

            if (resultJson.code == 1000) {
              that.testAddress(0, fId)
            } else {
              that.handleShowTextToast(resultJson.msg)
              that.showLoaded = false
            }
          } else {
            that.handleShowTextToast("含敏感文字，请修改");
            that.showLoaded = false
          }
        }
      },

      // 设置支付方式
      setPayType: async function() {
        // 获取商户配置属性 判断是微信还是收钱吧
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
        if (merchantInfo) {
          let merchantId = merchantInfo.cloudMerchantId;
          const configPayType = await api.checkoutPayType({
            header: {
              jwt: jwt
            },
            query: {
              config_name: 'PayTypeList',
              merchant_id: merchantId
            }
          });
          if (configPayType.code == 1000) {
            let configValue = configPayType.data.configValue;
            this.payTypeArr = JSON.parse(configValue);
            this.payTypeChange = this.payTypeArr[0];
            if (this.payTypeChange == 'Shouqianba') {
              this.payType = 'wosai:weixin:mini';
            }
            if (this.payTypeChange == 'Wechat') {
              this.payType = 'weixin';
            }
            if (this.payTypeChange == "GiftCard") {
              this.payType = "wosai:weixin:mini:giftcard";
            }
            this.payType = 'weixin';
          }
        }
      },
      //获取购物车商品列表
      getCartList: async function() {
        let that = this;
        // that.showLoaded = true;
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        // that.cartItems(that.realCartKey)
        const json = await api.checkoutOrder({
            method: 'PUT',
            header: {
              jwt: jwt
            }
          },
          that.realCartKey
        );
        if (json.code === 1000) {
          let discountsArr = [];
          this.orderDetail = json.data;
          this.discountFee = json.data.discountFee;
          this.postFee = json.data.postFee;
          this.itemTotal = json.data.itemTotal;
          this.list = json.data.items;
          this.totalPrice = json.data.total;
          let tempPayType = json.data.payType;
          that.payType = tempPayType;
          switch (tempPayType) {
            case 'weixin':
              that.payTypeChange = 'Wechat';
              break;
            case 'wosai:weixin:mini':
              that.payTypeChange = 'Shouqianba';
              break;
            case 'wosai:weixin:mini:giftcard':
              that.payTypeChange = 'GiftCard';
              break;
            default:
              that.payTypeChange = 'Shouqianba';
              break;
          }
          for (let i = 0; i < this.list.length; i++) {
            if (this.list[i].discounts && this.list[i].discounts.length > 0) {
              for (let j = 0; j < this.list[i].discounts.length; j++) {
                if (this.list[i].discounts[j].isCoupon == 0 && discountsArr.indexOf(this.list[i].discounts[j]
                    .discountName) == -1) {
                  discountsArr.push(this.list[i].discounts[j].discountName);
                }
              }
              if (!!this.orderDetail.couponRuleName) {
                // discountsArr.indexOf(this.orderDetail.couponRuleName) == -1
              }
            }
            if (this.list[i]['skuProperties']) {
              this.list[i].skuProperties = JSON.parse(this.list[i]['skuProperties']);
            }
            if (this.list[i].discounts != null) {
              this.list[i].discounts.sort(function(a, b) {
                return a.discountId - b.discountId;
              });
            }
            if (this.list[i].isGift == 1) {
              this.giftName = this.list[i].itemName;
            }
          }
          this.discountsArr = discountsArr;
          if (this.discountsArr.length == 1) {
            this.discountsArr[0].indexOf('运费') !== -1
            this.onlyFreight = true
          } else {
            this.onlyFreight = false
          }
          that.showLoaded = false;
        } else {
          this.showLoaded = false;
        }
      },

      /**
       * 获取提交订单时选择地址并设置地址和设置支付方式
       * @param id
       * @returns {Promise<void>}
       */
      getAddressInfo: async function(id) {
        let that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
        let customerId = customerInfo.customerId;
        let jwt = customerInfo.jwt;
        // 获取商户配置属性 判断是微信还是收钱吧
        let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
        let merchantId = merchantInfo.cloudMerchantId;
        if (that.payType == '' || that.payType == undefined || that.payType == null) {
          that.setPayType();
        }

        const json1 = await api.setOrderAddressId({
            method: 'PUT',
            header: {
              jwt: jwt
            }
          },
          that.realCartKey,
          0
        );
        const json2 = await api.setOrderPayType({
            method: 'PUT',
            header: {
              jwt: jwt
            }
          },
          that.realCartKey,
          this.payType
        );
        //设置地址和设置支付方式都成功才继续生成订单
        if (json2.code === 1000) {
          that.operating = true;
          that.getCartList();
          // that.getCouponList();
        }
      },

      // 点击提交订单再次选择地址并设置地址和设置支付方式
      testAddress: async function(id, fId) {
        let that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
        let customerId = customerInfo.customerId;
        let jwt = customerInfo.jwt;
        // 获取商户配置属性 判断是微信还是收钱吧
        let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
        let merchantId = merchantInfo.cloudMerchantId;

        if (that.payType == '' || that.payType == undefined || that.payType == null) {
          that.setPayType();
        }

        // 获取顾客地址信息
        const json = await api.setOrderAddressId({
            method: 'PUT',
            header: {
              jwt: jwt
            }
          },
          that.realCartKey,
          id
        );
        const json2 = await api.setOrderPayType({
            method: 'PUT',
            header: {
              jwt: jwt
            }
          },
          that.realCartKey,
          this.payType
        );
        if (json2.code === 1000) {
          this.goToPay(fId);
        } else if (json2.code !== 1000) {
          that.showLoaded = false
          that.handleShowTextToast(json2.msg)
        }
      },

      // 获取模板ID
      getTmplIds: async function() {
        let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
        const tmplIds = await api.customize({
          method: 'POST',
          query: {
            cloudMerchantId: merchantInfo.cloudMerchantId,
            cloudMerchantStoreId: merchantInfo.cloudMerchantStoreId,
            cloudStoreConfigtypeId: 59,
            cloudStoreConfigtypeName: 'Mini_Subscribe_Message_Config'
          }
        });
        if (tmplIds.code == 200) {
          if (!!tmplIds.data && !!tmplIds.data.cloudStoreConfigText) {
            const configText = tmplIds.data.cloudStoreConfigText;
            let configTextParse = JSON.parse(configText);
            let orderMessage = [];
            // 下单成功提醒
            if (configTextParse.paymentMsg == 1) {
              orderMessage.push(configTextParse.paymentTemplateId);
            }
            // 订单发货提醒
            if (configTextParse.shipmentMsg == 1) {
              orderMessage.push(configTextParse.shipmentTemplateId);
            }
            // 订单退款提醒
            if (configTextParse.applyRefundMsg == 1) {
              orderMessage.push(configTextParse.applyRefundTemplateId);
            }
            this.subscribeMessage = orderMessage;
          }
        }
      },

      goToPay: async function(formId) {
        if (!this.activitySelectionRecordId) {
          return false
        }
        let that = this;
        that.getTmplIds();
        uni.showLoading({
          title: '提交订单中',
          mask: true
        });
        const accountInfo = uni.getAccountInfoSync()
        that.showLoaded = false
        try {
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
          // 支付前生成订单 新增订单
          const json = await api.saveByCart({
            method: 'POST',
            header: {
              jwt: customerInfo.jwt
            },
            query: {
              cartKey: that.realCartKey,
              asr: that.activitySelectionRecordId
            }
          });
          if (json.code !== 1000) {
            uni.hideLoading()
            that.errorMessage = json.msg;
            // that.isShowNotice = true;
            // 部分区域不支持发货时
            let understock = json.msg.indexOf('商品库存不足')
            if (understock != -1) {
              that.handleShowTextToast('商品库存不足')
            } else {
              that.handleShowTextToast(json.msg);
            }
            let itemInfo = [];
            let errorInfo = [];
            itemInfo = json.msg.split('，');
            errorInfo = itemInfo[1].split('：');
            that.itemName = errorInfo[1];
          }
          //提交订单就去删除上一次的选择地址
          if (json.code === 1000) {
            that.youshuTrack(json)
            tip.loaded();
            that.$commonFunction.getCartList().then((res) => {
            }).catch((err) => {
            });
            that.orderId = json.data.orderId;
            that.checkOrderId = json.data.orderId
            let changeOrderIdType = JSON.stringify(that.orderId);
            let merchantInfo = uni.getStorageSync(MERCHANT_INFO) || getApp().globalData.merchantInfo
            let userSpecialInfo = uni.getStorageSync(USER_SPECICAL_INFO) || {};
						
            //商城-订单-确认订单
            that.trackOrderConfirm('确认下单', json.data);
            that.$commonSensors.popupEvent('PopupClick', {'popup_type' : '购买', 'popup_name': '确认提交订单弹窗', 'button_name': '确认下单'})
            const { orderCode, orderId, orderTime } = json.data;
						
						//  utm投放渠道参数 同步EF
						that.$commonFunction.handleSaveUtmByOrder(customerInfo,merchantInfo,orderCode);
						
            if (this.needSendWaitForPaySubscribeMessage) {
              sendWaitForPaySubscribeMessage(orderCode)
            }
            uni.hideLoading()
            that.$commonFunction.getOrderInfo(json.data.orderId).then((orderObj) => {
              let orderFlow = that.$programSetting.openAppointment;
              let objOrder = that.$commonFunction.isOrderType(orderObj, orderFlow);
              that.$commonFunction.payMoney(orderObj, that,objOrder).then((res) => {
              }).catch((err) => {
                uni.redirectTo({
                  url: '/pages/order/list'
                });
              })
            }).catch((err) => {
            });
            that.$commonSensors.saveByCartTrack(json.data.orderCode, that.orderDetail, that.list, that.drawAddInfo, true)
            // let enableMatomo = uni.getStorageSync('enableMatomo');
            // if (enableMatomo === true) {
            //   const orderJson = await api.getOrderInfo({
            //       header: {
            //         jwt: customerInfo.jwt
            //       }
            //     },
            //     that.orderId
            //   );
            //   if (orderJson.code === 1000) {
            //     let obj = orderJson.data;
            //     let orderItems = obj.items;
            //     //解析每个数组下面的items.skuProperties属性
            //     orderItems.forEach(function(item, index, array) {
            //       getApp().matomo.addEcommerceItem(item.skuCode, item.itemName, '全部商品', item.price / 1, item.qty);
            //     });
            //   }
            //   getApp().matomo.trackEcommerceOrder(changeOrderIdType, that.totalPrice, that.itemTotal, 0, that.postFee,
            //     that.discountFee);
            // }
          }
          // 新增订单结束
        } catch (error) {
          tip.loaded();
        }
      },
      youshuTrack(json) {
        try {
          this.$sr.track('custom_order', {
            order: {
              order_id: json.data?.orderCode.toString(),
              order_time: new Date(json.data?.orderTime.replace(/-/g, "/")).getTime() || new Date(json.data
                ?.orderTime).getTime(),
              order_status: 'give_order'
            },
            sub_orders: [{
              sub_order_id: json.data?.orderCode.toString(),
              order_amt: parseFloat(this.orderDetail?.itemTotal),
              pay_amt: parseFloat(this.orderDetail?.payment)
            }]
            // more...
          });
        } catch (error) {}
      },
      // 获取优惠券列表
      getCouponList: async function() {
        let that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
        let jwt = customerInfo.jwt;
        const couponList = await api.getPayCouponItem({
            method: 'GET',
            header: {
              jwt: jwt
            },
            query: {}
          },
          that.realCartKey
        );
        if (couponList.code === 1000) {
          if (couponList.data.length > 0 || couponList.data !== '') {
            let coulist = couponList.data;
            let ruleIds = [];
            for (let i in coulist) {
              ruleIds.push(coulist[i].couponRuleId);
            }
            that.couponRuleIds = ruleIds;
            that.getMemberCouponsByRuleIds(that.couponRuleIds, false);
          }
        }
      },

      bindKeyInput(e) {
        if (this.couponValue.length !== e.detail.value.length) {
          this.couponMessage = '';
        }
        this.couponValue = e.detail.value;
      },
      useCoupon: async function(e) {
        let that = this
        let couponValue = this.couponValue || e.currentTarget.dataset.couponcode;
        this.couponRuleName = e.currentTarget.dataset.rulename;
        this.getCoupon = 0;

        if (couponValue != '' && couponValue != undefined) {
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
          let jwt = customerInfo.jwt;
          const json = await api.useCoupon({
              method: 'PUT',
              header: {
                jwt: jwt
              },
              query: {}
            },
            that.realCartKey,
            couponValue
          );
          if (json.code === 1000) {
            this.getCartList();
          } else if (
            json.code == -1000 ||
            json.code == -1001 ||
            json.code == -1002 ||
            json.code == -1013 ||
            json.code == -1015 ||
            json.code == -1016
          ) {
            this.handleShowTextToast('抱歉！该优惠券不可用');
            this.couponValue = '';
          } else if (json.code == -1011 || json.code == -1014) {
            this.handleShowTextToast('抱歉！该优惠券使用次数已超限');
            this.couponValue = '';
          } else if (json.code == -1012) {
            this.handleShowTextToast('抱歉！该优惠券已过期');
            this.couponValue = '';
          }
        } else {
          this.handleShowTextToast('请输入优惠券');
          // this.couponMessage = "请输入优惠券";
        }
      },
      // 取消使用优惠券
      clearUseCoupon: async function() {
        let that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
        let jwt = customerInfo.jwt;
        const json = await api.clearCoupon({
            method: 'PUT',
            header: {
              jwt: jwt
            },
            query: {}
          },
          that.realCartKey
        );
        if (json.code === 1000) {
          this.handleShowTextToast('取消成功');
          this.couponShow = false;
          this.getCartList();
        } else {
          this.handleShowTextToast(json.msg);
        }
      },
      isShow(e) {
        var that = this;
        this.isShowNotice = e;
      },

      goPays: async function() {
        let that = this
        that.trackOrderSubmit();
        if (!this.checked) {
          this.handleShowTextToast("请勾选销售条款");
          return false
        } else {
          const r = await requestSubscribeMessageSync(['dvgPNQb-7HCYp09b7d-Tc6D6fGkcEOHY_lDOwK89COc'])
          if (r.length) {
          	this.needSendWaitForPaySubscribeMessage = true
          }
          // this.isAgreement = true
          // that.$commonSensors.popupEvent('PopupExposure', {'popup_type' : '购买', 'popup_name': '确认提交订单弹窗'})

          this.goPay()
        }
      },

      async goPay(e) {
        let that = this;
        var fId = e?.detail?.formId || "";
        this.isAgreement = false
        if (!!this.showLoaded) {
          return false
        } else {
          this.showLoaded = true
          //判断是否有备注内容
          if (that.orderRemarks !== '' && that.orderRemarks !== null && that.orderRemarks !== undefined) {
            that.setRemarks(that.orderRemarks, 'input');
          } else {
            that.testAddress(0, fId);
          }
        }

      },
      setAddress() {
        uni.navigateTo({
          url: '/pages/customer/address?type=order'
        });
      },
      //商城-订单-确认订单---用户在确认订单页面点击“再想想/确认下单”后返回此数据
      trackOrderConfirm(type, orderData = '') {
        let that = this;

        let clTrackPrams = {
          'c_confirm_result': type,
          'c_product_id': '',
          'c_product_name': '',
          'c_product_brand': '',
          'c_product_price': '',
          'c_product_year': '',
          'c_product_series': '',
          'c_product_scenarios': '',
          'c_product_taste': '',
          'c_product_alcoholconcentration': '',
          'c_product_volume': '',
          'c_order_id': !!orderData ? orderData.orderCode : '',
          'c_quantity': this.orderDetail.checkedTotalQty,
          'c_order_remark': '',
          'c_amount': this.orderDetail.payment,
          'c_campaignID': this.activitySelectionRecordId,
          'c_campaignName': this.activitySelectionName,
          'c_order_type': '抽签购买',
          'c_purchase_type': '立即购买',
        }
        that.list.forEach(function(item, index) {
          clTrackPrams.c_product_id += item.itemId + ';';
          clTrackPrams.c_product_name += item.itemName + ';';
          clTrackPrams.c_product_price += item.price + ';';
          clTrackPrams.c_product_volume += item.skuProperties[0].valueName + ';';
        });
        getApp().commonClTrack('c_ebmp_order_confirm', clTrackPrams)

      },

      //商城-订单-提交订单---用户点击提交订单后返回此数据
      trackOrderSubmit() {
        let that = this;

        let clTrackPrams = {
          'c_product_id': '',
          'c_product_name': '',
          'c_product_brand': '',
          'c_product_price': '',
          'c_product_year': '',
          'c_product_series': '',
          'c_product_scenarios': '',
          'c_product_taste': '',
          'c_product_alcoholconcentration': '',
          'c_product_volume': '',
          'c_order_id': '',
          'c_quantity': this.orderDetail.checkedTotalQty,
          'c_order_remark': '',
          'c_amount': this.orderDetail.payment,
          'c_campaignID': this.activitySelectionRecordId,
          'c_campaignName': this.activitySelectionName,
          'c_order_type': '抽签购买',
          'c_purchase_type': '立即购买',
        }
        that.list.forEach(function(item, index) {
          clTrackPrams.c_product_id += item.itemId + ';';
          clTrackPrams.c_product_name += item.itemName + ';';
          clTrackPrams.c_product_price += item.price + ';';
          clTrackPrams.c_product_volume += item.skuProperties[0].valueName + ';';
        });
        getApp().commonClTrack('c_ebmp_order_submit_new', clTrackPrams)
      },
      /**
       * 获取提交订单时选择地址并设置地址和设置支付方式
       * @param id
       * @returns {Promise<void>}
       */
      sourceBind: async function() {
        let that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
        let customerId = customerInfo.customerId;
        let jwt = customerInfo.jwt;
        // 获取商户配置属性 判断是微信还是收钱吧
        let merchantInfo = uni.getStorageSync(MERCHANT_INFO)
        let sourceInfo = uni.getStorageSync('sourceInfo');
        let timeStamp = new Date().getTime();
        if (sourceInfo.expirationTime > timeStamp) {
          // 获取顾客地址信息
          const json = await api.sourceBind({
              method: 'PUT',
              header: {
                jwt: jwt
              },
              query: {
                uid: customerInfo.openId,
                utmCampaign: '',
                utmContent: '',
                utmMedium: sourceInfo.utmMedium,
                utmSource: sourceInfo.utmSource,
                utmTerm: sourceInfo.utmTerm
              }
            },
            that.realCartKey
          );
          if (json.code === 1000) {

          }
        }
      },

      cartItems: async function() {
        let that = this;
        that.$commonFunction.getCartList(that.realCartKey).then((res) => {
          let shopCollect = res;
          that.cartBagItems = res;
          let cartlistData = shopCollect.items;
          let discountsArr = [];
          let stockNullList = [];
          let stockNumber = [];
          let stocklessQty = [];
          let stockHaveList = [];
          if (cartlistData !== null && cartlistData.length > 0) {
            that.buttonShow = false;
            that.totalPrice = shopCollect.total;
            that.itemTotal = shopCollect.itemTotal;
            that.payment = shopCollect.payment;

            if (shopCollect.allGifts != '' && shopCollect.allGifts != null && shopCollect.allGifts != undefined) {
              that.allGifts = true;
            }
            // this.$parent.$wxapp.matomo.trackEcommerceCartUpdate(that.totalPrice)
            that.discountFee = shopCollect.discountFee;
            that.postFee = shopCollect.postFee;
            that.couponFee = shopCollect.couponFee;
            that.disTotal = Number(that.discountFee / 1) + Number(that.couponFee / 1);
            that.disTotal = that.disTotal.toFixed(2);

            for (var i = 0; i < cartlistData.length; i++) {
              if (cartlistData[i]['skuProperties']) {
                cartlistData[i].skuProperties = JSON.parse(cartlistData[i]['skuProperties']);
              }
              if (cartlistData[i].discounts && cartlistData[i].discounts.length > 0) {
                for (let j = 0; j < cartlistData[i].discounts.length; j++) {
                  if (cartlistData[i].discounts[j].isCoupon == 0 && discountsArr.indexOf(cartlistData[i]
                      .discounts[j]
                      .discountName) == -1) {
                    discountsArr.push(cartlistData[i].discounts[j].discountName);
                  }
                }
              }

              // 赠品名称
              if (cartlistData[i].isGift == 1) {
                that.giftName = cartlistData[i].itemName;
              } else {
                that.giftName = '';
              }

              // 库存判断
              if (cartlistData[i]['stockQty'] == 0 || cartlistData[i].inValid == 1 || cartlistData[i]
                .skuProperties[0]
                .approveStatus == 'instock') {
                cartlistData[i].safe = -1;
                stockNumber.push(i);
                stockNullList.push(cartlistData[i]);
              } else if (cartlistData[i]['stockQty'] <= cartlistData[i]['qty'] + this.safeNum && cartlistData[i]
                .inValid !==
                1) {
                if (cartlistData[i]['stockQty'] < cartlistData[i]['qty']) {
                  this.addGoodNum(cartlistData[i]['skuId'], cartlistData[i]['stockQty'], i);
                  cartlistData[i]['qty'] = cartlistData[i]['stockQty'];
                }
                cartlistData[i].safe = 0;
                stockHaveList.push(cartlistData[i]);
              } else {
                if (cartlistData[i].inValid !== 1) {
                  cartlistData[i].safe = 2;
                  stockHaveList.push(cartlistData[i]);
                }
              }
              this.totalNum += cartlistData[i].stockQty;

              if (shopCollect.customerAddressId) {
                uni.setStorageSync(ADDRESS_ID, shopCollect.customerAddressId);
              }
            }
            this.discountsArr = discountsArr;
            let cartItems = cartlistData;
            this.cartNum = shopCollect.availableTotalQty;
            // that.$store.commit('changeCartNum', shopCollect.availableTotalQty)
            // uni.setStorageSync('cartNum', shopCollect.availableTotalQty);
          } else {
            uni.removeStorageSync('cartNum');
            this.cartNum = 0;
            that.buttonShow = true;
          }
          that.listData = stockHaveList.concat(stockNullList);
          that.cartHaveQty = stockHaveList;
          for (var j = 0; j < that.cartHaveQty.length; j++) {
            // 是否全部选中
            if (!that.cartHaveQty[j].isChecked) {
              this.allChecked = false;
            }
          }
          that.showLoaded = false;

          that.isClickCoupon = !that.isClickCoupon;
        }).catch((err) => {
          that.handleShowTextToast(err.msg);
        });
      },
      // 显示输入和查看优惠券
      couponOpenshow() {
        let that = this;
        this.couponShow = !this.couponShow;
        this.couponMessage = '';
      },

      // 显示可用优惠券
      couponOpen() {
        this.isShowCouponList = true;
      },

      // 关闭可用优惠券
      closeCoupon() {
        let that = this;
        // that.getCoupon = 0;
      },
      // 手动输入优惠券码
      bindKeyInput(e) {
        if (this.couponValue.length !== e.detail.value.length) {
          this.couponMessage = '';
        }
        this.couponValue = e.detail.value;
      },
      useCoupon: async function(e) {
        let that = this
        let couponValue = e.currentTarget.dataset.couponcode;
        this.couponRuleName = e.currentTarget.dataset.rulename;
        // this.getCoupon = 0;
        this.isShowCouponList = false;

        if (couponValue != '' && couponValue != undefined) {
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
          let jwt = customerInfo.jwt;
          const json = await api.useCoupon({
              method: 'PUT',
              header: {
                jwt: jwt
              },
              query: {}
            },
            that.realCartKey,
            couponValue
          );
          if (json.code === 1000) {
            this.getCartList();
            this.saveCoupon = couponValue;
          } else if (
            json.code == -1000 ||
            json.code == -1001 ||
            json.code == -1002 ||
            json.code == -1013 ||
            json.code == -1015 ||
            json.code == -1016
          ) {
            this.handleShowTextToast('抱歉！该优惠券不可用');
            // this.couponValue = '';
            this.useCouponHasChoose(this.saveCoupon);
            // this.clearUseCoupon(true)
          } else if (json.code == -1011 || json.code == -1014) {
            this.handleShowTextToast('抱歉！该优惠券使用次数已超限');
            // this.clearUseCoupon(true)
          } else if (json.code == -1012) {
            this.handleShowTextToast('抱歉！该优惠券已过期');
            // this.couponValue = '';
            this.useCouponHasChoose(this.saveCoupon);
            // this.clearUseCoupon(true)
          }
        } else {
          this.handleShowTextToast('请输入有效的优惠券');
          // this.couponMessage = "请输入优惠券";
        }
      },
      useCouponByInput: async function(e) {
        let that = this;
        let couponValue = this.couponValue || e.currentTarget.dataset.couponcode;
        this.couponRuleName = e.currentTarget.dataset.rulename;
        // this.getCoupon = 0;
        this.isShowCouponList = false;

        if (couponValue != '' && couponValue != undefined) {
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
          let jwt = customerInfo.jwt;
          const json = await api.useCoupon({
              method: 'PUT',
              header: {
                jwt: jwt
              },
              query: {}
            },
            that.realCartKey,
            couponValue
          );
          if (json.code === 1000) {
            this.getCartList();
            this.saveCoupon = couponValue;
          } else if (
            json.code == -1000 ||
            json.code == -1001 ||
            json.code == -1002 ||
            json.code == -1013 ||
            json.code == -1015 ||
            json.code == -1016
          ) {
            this.errorCouponWarn = '请输入有效的优惠券';
            setTimeout(function() {
              that.errorCouponWarn = '';
            }, 2000);
            if (!!this.saveCoupon) {
              this.useCouponHasChoose(this.saveCoupon);
            }
          } else if (json.code == -1011 || json.code == -1014) {
            this.errorCouponWarn = '抱歉！该优惠券使用次数已超限';
            setTimeout(function() {
              that.errorCouponWarn = '';
            }, 2000);
            if (!!this.saveCoupon) {
              this.useCouponHasChoose(this.saveCoupon);
            }
          } else if (json.code == -1012) {
            this.errorCouponWarn = '抱歉！该优惠券已过期';
            setTimeout(function() {
              that.errorCouponWarn = '';
            }, 2000);
            if (!!this.saveCoupon) {
              this.useCouponHasChoose(this.saveCoupon);
            }
          }
        } else {
          this.errorCouponWarn = '请输入有效的优惠券';
          setTimeout(function() {
            that.errorCouponWarn = '';
          }, 2000);
          if (!!this.saveCoupon) {
            this.useCouponHasChoose(this.saveCoupon);
          }
        }
      },
      // 恢复已选优惠券
      useCouponHasChoose: async function(couponValue) {
        if (couponValue != '' && couponValue != undefined) {
          let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
          let jwt = customerInfo.jwt;
          const json = await api.useCoupon({
              method: 'PUT',
              header: {
                jwt: jwt
              },
              query: {}
            },
            that.realCartKey,
            couponValue
          );
          if (json.code === 1000) {
            this.getCartList();
          } else if (
            json.code == -1000 ||
            json.code == -1001 ||
            json.code == -1002 ||
            json.code == -1013 ||
            json.code == -1015 ||
            json.code == -1016
          ) {
            this.handleShowTextToast('抱歉！该优惠券不可用');
            this.couponValue = '';
            // this.clearUseCoupon(true)
          } else if (json.code == -1011 || json.code == -1014) {
            this.handleShowTextToast('抱歉！该优惠券使用次数已超限');
            // this.clearUseCoupon(true)
          } else if (json.code == -1012) {
            this.handleShowTextToast('抱歉！该优惠券已过期');
            this.couponValue = '';
            // this.clearUseCoupon(true)
          }
        } else {
          this.handleShowTextToast('请输入有效的优惠券');
          // this.couponMessage = "请输入优惠券";
        }
      },
      // 取消使用优惠券
      clearUseCoupon: async function(bool) {
        let that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
        let jwt = customerInfo.jwt;
        const json = await api.clearCoupon({
            method: 'PUT',
            header: {
              jwt: jwt
            },
            query: {}
          },
          that.realCartKey
        );
        if (json.code === 1000) {
          that.handleShowTextToast('取消成功');
          that.placeholder = '请输入优惠券码';
          this.couponShow = false;
          this.getCartList();
        } else {
          this.handleShowTextToast(json.msg);
        }
      },

      /**
       * 获取可用优惠券列表
       * 自动发放的满足条件直接显示，需领取的领取之后才显示
       * 判断优惠券是否可用
       */

      getMemberCouponsByRuleIds: async function(couponRuleIds, noOpen) {
        let that = this;
        that.usableCoupon = [];
        let jwt = uni.getStorageSync(CUSTOMER_INFO).jwt;
        const couponList = await api.getValidCoupon({
            method: 'GET',
            header: {
              jwt: jwt
            },
            params: {}
          },
          couponRuleIds
        );
        if (couponList.code === 1000) {
          if (couponList.data.length > 0) {
            let usableCouponList = couponList.data;
            for (let i in usableCouponList) {
              if (usableCouponList[i].timesUsed < usableCouponList[i].timesLimit) {
                that.usableCoupon.push(usableCouponList[i]);
              }
              let c_item = [];
              let couponFailureTime = '';
              for (let j in that.usableCoupon) {
                c_item = that.usableCoupon[j];

                if (c_item.expirationDate != null && (c_item.expirationDate != undefined) & (c_item.expirationDate !=
                    '')) {
                  couponFailureTime = util.UTCformat(c_item.expirationDate);
                } else {
                  couponFailureTime = util.UTCformat(c_item['couponRule'].toDate);
                }

                let timearr = couponFailureTime.split(' '); //只取年月日
                c_item['couponRule'].toDate = timearr[0];
              }
              if (that.usableCoupon.length > 0 && !noOpen) {
                that.isShowCouponList = true;
              }
            }
          }
        }
      },
      // 获取优惠券列表
      getCouponList: async function(noOpen) {
        let that = this;
        let customerInfo = uni.getStorageSync(CUSTOMER_INFO)
        let jwt = customerInfo.jwt;
        const couponList = await api.getPayCouponItem({
            method: 'GET',
            header: {
              jwt: jwt
            },
            query: {}
          },
          that.realCartKey
        );
        if (couponList.code === 1000) {
          that.usableCoupon = [];
          if (couponList.data.length > 0 || couponList.data !== '') {
            let coulist = couponList.data;
            let ruleIds = [];
            for (let i in coulist) {
              ruleIds.push(coulist[i].couponRuleId);
            }
            that.couponRuleIds = ruleIds;
            that.getMemberCouponsByRuleIds(that.couponRuleIds, true);
          }
        }
      },
      showUseCouponClick() {
        this.showUseCoupon = !this.showUseCoupon;
      }
    }
  };
</script>
<style lang="less">
.comfire_order{
    font-family: FrankNew-Regular,NotoSansSC-Regular;
  }
  .font_24{
    font-size: 24rpx;
  }
  .font_28{
    font-size: 28rpx;
  }
  .color_757575{
    color: #757575;
  }
  .color_000000{
    color: #000000;
  }
  .color_1a1a1a{
    color: #1a1a1a;
  }
  // 地址
  .address {
    background: #fff;
    .empty_address,
    .address_info {
      position: relative;
      display: flex;
      justify-content:flex-start;
      align-items: flex-start;
      padding: 32rpx;
      margin: 40rpx 48rpx 0;
      background-color: #fafafa;
      .location_icon{
        width: 48rpx;
        height: 48rpx;
        margin-right: 16rpx;
      }
      .title_info {
        width: 462rpx;
        margin-left:16rpx;
      }
      .user_name {
        color: #1a1a1a;
        margin-bottom: 48rpx;
        font-family: NotoSansSC-Medium;
        font-size: 28rpx;
        font-weight: 500;
        line-height: 48rpx;
      }
      .phone_style{
        color: #757575;
        font-family: FrankNew-Regular;
        font-size: 28rpx;
        font-weight: 400;
        line-height: 48rpx;
      }
      .arrow_right{
        width: 48rpx;
        height: 48rpx;
        position: absolute;
        right: 32rpx;
        top:50%;
        margin-top: -24rpx;
      }

      .defult {
        color: #ff571a;
      }
    }
  }

  // 提示
  .tips {
    display: flex;
    margin: 0 35rpx;
    font-size: 25rpx;

    .text {
      flex: 1
    }
  }

  .tip_box {
    margin-left: 48rpx;
    margin-right: 48rpx;
    padding-top: 24rpx;
    position: relative;
    border-top: 1px solid #f2f2f2;
    font-family: NotoSansSC-Regular !important;
  }

  .tip_box_show{
    padding-bottom: 580rpx;
  }
  .tip_box_hidden{
    padding-bottom: 450rpx;
  }

  .bottom-agreement {
    background-color: #fff;
    border-bottom: 1px solid #f2f2f2;
  }

  .agreement {
    margin: 32rpx 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
  }

  .agreement-left{
    width:32rpx;
    height:32rpx;
    flex-shrink:0;
    margin-right: 24rpx;
    margin-top: 2px;
  }
  .agreement-right{
    font-family: FrankNew-Regular,NotoSansSC-Regular;
    line-height: 40rpx;
  }

  .order_info {
    .block {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 30rpx 35rpx;
      border-bottom: 1px solid #e7e7e7;
      background: #fff;

      .txt {
        font-size: 32rpx;
      }

      .right {
        color: #9a9a9a;
      }

      .price {
        color: #ea4a3a;
        font-size: 32rpx;
      }

      .tongji {
        margin-bottom: 20rpx;
      }

      .total_jf {
        font-size: 32rpx;
      }
    }
  }

  .goods-info {
    width: 100%;
    height: 352rpx;
    display: flex;
    box-sizing: border-box;
    position: relative;
    // margin-bottom: 16rpx;
    background-color: #fafafa;
  }
  .goods-info .img-box {
    width: 264rpx;
    height: 100%;
  }

  .goods-info .text-box {
    width: 390rpx;
    height: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    flex-direction: column;
    padding-right: 48rpx;
  }

  .goods-info .text-box .goods-title {
    color: #000;
    padding: 0;
    font-size: 28rpx;
    line-height: 48rpx;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; // 控制多行的行数
    -webkit-box-orient: vertical;
    font-family: NotoSansSC-Medium;
    font-weight: 500;
  }

  .goods-info .text-box .goods-label {
    font-size: 26rpx;
    color: #999;
    height: 38rpx;
    line-height: 38rpx;
    margin: 8rpx 0 25rpx 0;
  }

  .lable {
    display: flex;

    .goods-label {
      font-size: 26rpx;
    }

    .goods-lable {
      font-size: 26rpx;
    }
  }

  .num-change {
    width: 190rpx;
    height: 64rpx;
    box-sizing: border-box;
    border: 1px solid #f2f2f2;
    display: flex;
    font-size: 26rpx;
    justify-content: center;
    align-items: center;
    background-color: #fff;
    text-align: center;

    .jian-btn {
      width: 40rpx;
      height: 40rpx;
      font-size: 36rpx;
    }


    .numjia {
      width: 40rpx;
      height: 40rpx;
      font-size: 36rpx;
    }



    input {
      border: none;
      width: 70rpx;
      height: 48rpx;
      min-height: 48rpx;
      text-align: center;
      font-size: 30rpx;
      z-index: 1;
    }


  }
  .buy-number {
    text-align: center;
    font-size: 24rpx;
    font-family: FrankNew-Regular;
    margin-right: 4px;
  }


  .goods-info .text-box .buy-num {
    line-height: 39rpx;
    color: #aeaeae;
  }

  .outerLayer {
    width: 54rpx;
    height: 100%;
    display: flex;
    align-items: center;
  }

  .flex_end{
    justify-content: flex-end;
  }
  .flex_start{
    justify-content: flex-start;
  }

  // .jian-button {
  //   width: 50rpx;
  //   height: 70rpx;
  //   display: flex;
  //   justify-content: flex-end;
  //   align-items: center;
  //   margin-right: 10rpx;
  // }

  // .jia-button {
  //   width: 50rpx;
  //   height: 70rpx;
  //   display: flex;
  //   justify-content: flex-start;
  //   align-items: center;
  //   margin-left: 10rpx;
  // }

  .goods-info .text-box .buy-num .jian-btn {
    width: 48rpx;
    height: 100%;
    border-left: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    border-top: 1px solid #ccc;
    border-bottom-left-radius: 6rpx;
    border-top-left-radius: 6rpx;
  }

  .goods-info .text-box .buy-num .jian-btn.disabled {
    background-color: #f5f5f9;
    border-left: 1px solid #eee;
    border-bottom: 1px solid #eee;
    border-top: 1px solid #eee;
    color: #ccc;
  }

  .goods-info .text-box .buy-num .jia-btn {
    width: 48rpx;
    height: 100%;
    border-right: 1px solid #ccc;
    border-bottom: 1px solid #ccc;
    border-top: 1px solid #ccc;
    border-bottom-right-radius: 6rpx;
    border-top-right-radius: 6rpx;
  }

  .goods-info .text-box .buy-num .jia-btn.disabled {
    background-color: #f5f5f9;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    border-top: 1px solid #eee;
    color: #ccc;
  }

  .goods-info .text-box .buy-num input {
    width: 68rpx;
    height: 48rpx;
    min-height: 48rpx;
    text-align: center;
    font-size: 24rpx;
    border: 1px solid #ccc;
  }

  .goods-info .img-box .img {
    width: 100%;
    height: 100%;
  }

  .dk-jf {
    text-align: right;
    color: #666;
  }

  .o-order-summary {
    width: 100%;
    display: flex;
    flex-direction: column;
    font-size: 27rpx;
  }

  .o-order-summary span:nth-of-type(2) {
    float: right;
  }

  .order_money {
    display: block !important;
    height: auto !important;
  }

  .goodsList {
    padding: 48rpx 48rpx 0 48rpx;
  }

  .goodsList .tongji {
    margin-bottom: 20rpx;
  }

  .list_box {
    // background-color: #fafafa;
    margin-bottom: 16rpx;
  }

  .list_box:last-child{
    margin-bottom: 0;
  }
  // .list_box:last-child {
  //   padding: 0;
  //   margin: 0;
  //   border-bottom: none;
  // }

  .goods-price,
  .linePrice,
  .nowPrice {
    font-size: 36rpx;
  }

  .mark {
    margin-right: 4rpx;
    font-family: NotoSansSC-Regular;
  }

  .total-section {
    text-align: right;
    padding-right: 10rpx;
  }

  .buy-num view {
    font-family: 'mHei', serif;
    line-height: 58rpx;
  }

  .active_address .defult {
    display: none;
  }

  .coupon_box {
    display: flex;
    width: 100%;
  }

  .coupon_box input {
    padding-left: 8rpx;
    width: 75%;
    background-color: #e7e7e7;
    height: 52rpx;
  }

  .coupon_box .btnStyle {
    width: 40%;
    height: 52rpx;
    line-height: 52rpx;
  }

  .coupon_act {
    font-size: 27rpx;
  }

  .coupon_act text {
    float: right;
  }

  .goods-info .text-box .lable {
    font-size: 26 rpx;
    color: #999;
    margin: 10rpx 0;
  }

  .goods-info .lable {
    display: flex;
    flex-direction: column;
  }

  .goods-info .lable .bo-label {
    color: #757575;
    font-size: 24rpx;
    font-family: FrankNew-Regular;
    line-height: 40rpx;
  }

  .bottomBox {
    width:100%;
    display: flex;
    justify-content: flex-start;
    align-items: center;
  }

  .icon-jiantou32,
  .icon-jiantou31 {
    font-size: 32rpx;
  }

  .icon-jiantouxiangyou {
    font-size: 40rpx;
    width: 32rpx;
    color: #666;
  }

  .m-radio-button-selector {
    padding: 20rpx 35rpx;
  }

  .m-radio-button-selector .title {
    margin-bottom: 20rpx;
  }

  .m-radio-button {
    padding: 30rpx;
    background-color: #f9f9f9;
  }

  .m-radio-button .custom-radio {
    float: right;
    width: 20px;
    height: 20px;
  }

  .a-radio-button.is-checked+.custom-radio:after,
  .a-radio-button:checked+.custom-radio:after {
    background-color: #000;
    content: ' ';
    width: 16rpx;
    height: 16rpx;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    top: 12rpx;
    left: 12rpx;
    border: 1px solid #f8f8f8;
  }

  .m-radio-button .a-label.label-text {
    font-size: 15px;
    display: inline-block;
    margin-right: 0;
    width: 50%;
  }

  .m-radio-button .a-label.label-text.sqb {
    padding-left: 50rpx;
    background: url('https://efs-cloud-miniprogram-store-1252208446.cos.ap-shanghai.myqcloud.com/fonts/svg/wxPay.svg') no-repeat left center;
    background-size: 18px 18px;
  }

  .m-radio-button p.a-paragraph {
    height: 40rpx;
    line-height: 40rpx;
    padding-left: 10rpx;
  }

  .m-radio-button .a-radio-button {
    display: none;
    cursor: pointer;
  }

  .a-radio-button+.custom-radio {
    background-color: #e7e7e7;
    cursor: pointer;
    box-sizing: border-box;
    position: relative;
    display: inline-block;
    width: 28rpx;
    height: 28rpx;
    border-radius: 50%;
    vertical-align: top;
  }

  .m-radio-button .custom-radio {
    float: right;
    width: 40rpx;
    height: 40rpx;
  }

  .shipping-section.freight {
    margin-bottom: 20rpx;
  }

  .saleText_2 {
    color: #ff571a;
    // margin: 10rpx 0;
  }

  .saleTab {
    color: #ff571a;
  }

  .text-box .saleTab span {
    color: #ff571a;
    padding-right: 10rpx;
  }

  /* 优惠券弹窗 */
  .couponItem {
    background-color: #fff;
    padding: 0 10px 8rpx 10px;
    box-shadow: 0 1px 10px #666;
    margin: 20rpx 30rpx;
    position: absolute;
    top: 25%;
    width: 86%;
    z-index: 1002;
  }

  .couponItem .coucontent {
    margin-bottom: 30rpx;
  }

  .couponItem .cousubstance {
    background-color: #f5f5f5;
    padding: 40rpx;
  }

  .couponItem h4 {
    font-size: 36rpx;
    display: block;
    margin-bottom: 10rpx;
  }

  .couponItem .copRule {
    border-top: 1px solid #d2d2d2;
    padding-top: 24rpx;
    text-align: right;
    overflow: hidden;
  }

  .couponItem .copRule span {
    float: left;
  }

  .couponItem .description {
    padding-top: 8rpx;
    overflow: hidden;
    display: block;
    margin-bottom: 20rpx;
  }

  .couponItem .btn.s2 {
    background-color: #fff;
    color: #444;
    border: 1px solid #999;
  }

  .couponItem .icon-cuowu1 {
    font-size: 58rpx;
    position: absolute;
    right: 0;
    top: 0;
    width: 80rpx;
  }

  .discounts-arr-box {
    max-width: 270px;
  }

  .discounts-item {
    display: block;
    text-align: right;
  }

  .discounts-item:last-child {
    padding-right: 0;
    border-right: 1px solid transparent;
  }

  .distribution {
    display: flex;
    justify-content: space-between;
    font-family: NotoSansSC-Regular;
    width: 100%;
    height:64rpx;
    line-height: 64rpx;
    margin-top: 48rpx;
    margin-bottom: 16rpx;
  }

  .order-remarks {
    display: flex;
    align-items: center;
    padding: 30rpx 0;
    font-size: 32rpx;
    margin: 10rpx 48rpx;

    .title {
      margin-right: 20rpx;
    }

    .input {
      flex: 1;
      margin-top: 4rpx;

      input {
        color: #ddd;
        font-size: 26rpx;
      }
    }
  }

  .no-address {
    background-color: #c6c6c6 !important;
    color: #757575 !important;
  }

  .linePrice {
    text-decoration: line-through;
    color: #444444;
    font-size: 24rpx;
  }

  // 划线价
  .markPrice {
    display: flex;
    margin-top: 8rpx;

    .linePrice {
      text-decoration: line-through;
      font-size: 36rpx;
      line-height: 36rpx;
    }

    .nowPrice {
      margin-left: 10rpx;
      color: #862633;
      line-height: 36rpx;
    }
  }

  .cartTotal {
    margin-top: 40rpx;
    padding: 0 38rpx;
    padding-bottom: 120rpx;
  }

  .cartTotal .item {
    display: flex;
    justify-content: space-between;
    font-size: 26rpx;
    margin-bottom: 34rpx;
  }

  .cartTotal .item .look-coupon-list {
    border-bottom: 1px solid #000;
    line-height: 34rpx;
    font-size: 26rpx;
    margin-top: 2rpx;
  }

  .cartTotal .item .total {
    font-size: 26rpx;
    font-family: rutanRegular;
  }

  .cartTotal .item .coupon_act {
    color: #000;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    width: 80%;
  }

  .cartTotal .item .coupon_act .cancel-coupon {
    color: #999;
    border-bottom: 1px solid #999;
    display: inline-block;
    margin-right: 20rpx;
  }

  .couponInput {
    border: 1px solid #7f7f7f;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: space-between;
  }

  .couponInput input {
    width: 100%;
    height: 60rpx;
    line-height: 60rpx;
    font-size: 15px;
    padding: 0px;
    flex: 1;
    padding-left: 10rpx;
    font-size: 24rpx;
  }

  .couponInput .btn {
    height: 60rpx;
    line-height: 60rpx;
    background-color: #7f7f7f;
    color: #fff;
    font-size: 24rpx;
    width: 200rpx;
    text-align: center;
  }

  .couponList {
    padding: 40rpx;
    margin-top: 50rpx;
    padding-bottom: 200rpx;
  }

  .couponList .item {
    background-color: #f0f0f0;
    padding: 20rpx;
    margin-bottom: 30rpx;
    display: block;
    color: #999;
  }

  .couponList .item label {
    display: block;
    margin-bottom: 6rpx;
    font-size: 26rpx;
    color: #000;
  }

  .cartTotal .couponBox {
    position: relative;
    font-size: 26rpx;
    display: block;
  }

  .cartTotal .couponTitle {
    display: flex;
    justify-content: flex-end;
  }

  .cartTotal .aos_mp {
    font-size: 26rpx;
  }

  .cartTotal .aos_mp-arrow-down {
    width: 42rpx;
  }

  .cartTotal .aos_mp-arrow-down:before {
    content: '';
  }

  .cartTotal .aos_mp-arrow-down:after {
    content: '\e60c';
    font-size: 32rpx;
    position: absolute;
    right: 0;
    top: 0;
    color: #000;
  }

  .cartTotal .aos_mp-arrow-down.act {
    transform: rotate(180deg);
  }

  .cartTotal .couponInput .weui-input {
    border-bottom: 1px solid #000;
    height: 40rpx;
    margin-top: 10rpx;
  }

  .cartTotal .couponInput button {
    margin: 60rpx 0;
    text-align: center;
    border: 2px solid #000;
    border-radius: 0;
    background-color: #fff;
    font-size: 26rpx;
    font-family: syHeavy;
  }

  .cartTotal .couponName {
    margin-left: 30rpx;
  }

  .cartTotal .couponList {
    padding: 0 40rpx 200rpx 40rpx;
  }

  .cartTotal .couponList li {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40rpx;
  }

  .cartTotal .couponList strong {
    display: block;
    font-size: 26rpx;
    font-family: syHeavy;
  }

  .couponText {
    display: flex;
  }

  .couponText .cancel {
    display: inline-block;
    color: #000;
    border-bottom: 1px solid #000;
  }

  /* 已加入购物车商品售完的情况 */
  .noGoods .goods-info .text-box .goods-title,
  .noGoods .goods-info .lable .bo-label,
  .noGoods .goods-info .markPrice .linePrice,
  .noGoods .goods-info .markPrice .nowPrice {
    color: #d8d8d8;
  }

  .noGoods .goods-info .text-box .buy-num {
    display: none;
  }

  .topBox {
    position: fixed;
    left: 0;
    top: 0;
    width: 100%;
    height: 100vh;
    background-color: #fff;
    z-index: 9999;
    overflow-y: auto;
    margin-top: 116rpx;
    padding: 0;
  }

  .topBox .a-icon-close {
    top: 40rpx;
    right: 20rpx;
    position: absolute;
  }

  /* 提示 */
  .tipsRed {
    color: #ff571a;
    font-size: 22rpx;
    margin-bottom: 10rpx;
    font-family: syLIGHT;
  }

  /* 签名弹框 */
  .topBoxSmall .cont {
    height: auto;
  }

  .autograph {
    text-align: center;
    font-size: 28rpx;
  }

  .autograph .box {
    padding: 60rpx 0;
    line-height: 60rpx;
    width: 70%;
    margin: auto;
  }

  .autograph label {
    font-size: 30rpx;
    display: block;
    line-height: 56rpx;
  }

  .autograph .btnBox {
    display: flex;
    justify-content: center;
    margin-top: 50rpx;
  }

  .autograph .btnBox .btn1 {
    border: 1px solid #000;
    background-color: #fff;
    width: 200rpx;
  }

  .autograph .btnBox .btn2 {
    background-color: #000;
    color: #fff;
    border: none;
    margin-left: 30rpx;
    min-width: 200rpx;
  }

  .cpTitle {
    font-size: 36rpx;
    text-align: center;
    margin: 0 0 50rpx 0;
  }

  .couponItem {
    background-color: #f0f0f0;
    padding: 20rpx;
    margin-bottom: 30rpx;
  }

  .couponItem.act {
    border: 1px solid #000;
  }

  .couponItem label {
    display: block;
    color: #000;
    font-size: 26rpx;
  }

  .couponItem text {
    color: #999;
  }

  .salePrice {
    font-size: 26rpx;
  }

  .check_1 {
    background-color: #000;
    color: #fff;
    padding: 4rpx 4rpx 6rpx 4rpx;
    font-size: 23rpx;
    width: 28rpx;
    height: 26rpx;
    margin-top: 88rpx;
  }

  .discounts-arr-box {
    max-width: 270px;
  }

  .discounts-item {
    display: block;
    text-align: right;
  }

  .discounts-item:last-child {
    padding-right: 0;
    border-right: 1px solid transparent;
  }

  .warn-info {
    font-size: 26rpx;
    position: absolute;
    left: 0;
    top: 0rpx;
    color: #ff571a;
  }

  .cartTotal .giftBox {
    font-size: 26rpx;
    padding-top: 30rpx;
  }

  .warn-coupon {
    color: #ff571a;
    font-size: 26rpx;
    text-align: center;
  }

  .mb20 {
    margin-bottom: 20rpx;
  }

  .cartCoupon {
    padding-bottom: 8rpx;
    margin-bottom: 26rpx;
  }

  /* 已加入购物车商品售完的情况 */
  .noGoods .goods-info .text-box .goods-title,
  .noGoods .goods-info .lable .bo-label,
  .noGoods .goods-info .markPrice .linePrice,
  .noGoods .goods-info .markPrice .nowPrice {
    color: #d8d8d8;
  }

  .noGoods .goods-info .text-box .price {
    color: #d8d8d8;
  }

  .noGoods .goods-info .text-box .buy-num {
    display: none;
  }

  .cp {
    position: relative;
  }

  .icon-jiantouxiangyou.act {
    transform: rotate(270deg);
    left: 90rpx;
    top: 0;
  }

  .textareaBox {
    height: 50px;
    display: inline-block;
    width: 100%;
    border: 2rpx solid #ddd;
  }

  .bottomBar {
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    border-top: 1px solid #f2f2f2;
    z-index: 10;
    position: fixed;
    bottom: 0;
    width: 100%;
    box-shadow: 0px 0px 32px 0px #0000000A;
    // padding: 0 48rpx 22rpx 48rpx;
    padding: 0 48rpx 30rpx 48rpx;
    background-color: #fff;

    &.noBottom {
      padding-bottom: 0;
    }
  }

  .bottom_submit{
    width: 100%;
  }

  .order_show{
    height: 224rpx !important;
  }
  .order_hidden{
    height: 80rpx !important;
  }
  .order_value_section {
    padding-top: 32rpx;
    height: 80rpx;
    overflow: hidden;
    transition: all 300ms;
    display: flex;
    flex-direction: column-reverse;
    .order_item{
      width: 100%;
      height: 48rpx;
      line-height: 48rpx;
      margin-bottom: 24rpx;
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 28rpx;
      font-weight: 500;
    }
    .order_item:first-child{
      margin-bottom: 0;
    }
    .title {
      padding-right: 8rpx;
    }
    .arrow_top{
      width: 48rpx;
      height: 48rpx;
      transition: all 300ms;
    }
    .arrow_show{
      transform: rotate(-90deg);
    }
    .arrow_hidden{
      transform: rotate(90deg);
    }
    .mark2{
      padding-right: 4rpx;
    }
    .title,.mark {
      font-family: NotoSansSC-Medium;
    }
    .priceNum {
      font-family: FrankNew-Medium;
    }
    .title2,.mark2 {
      font-family: NotoSansSC-Regular;
    }
    .priceNum2 {
      font-family: FrankNew-Regular;
    }
    .priceNum,.priceNum2{
      padding-top: 1px;
    }
    .title2,.mark2,.priceNum2{
      font-weight: 400;
      color: #757575;
    }
  }

  .flex_style{
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .pay_box {
    width: 100%;
    height: 80rpx;
    margin: 32rpx 0 20rpx 0;
    .btnStyle {
      width: 286rpx;
      height: 90rpx;
      background-color: #CB171A;
      color: #fff;
    }
  }

  /*checkbox 整体大小  */
  checkbox {
    width: 40rpx;
    height: 40rpx;
  }

  /*checkbox 选项框大小  */
  checkbox .wx-checkbox-input {
    width: 30rpx;
    height: 30rpx;
  }

  /*checkbox选中后样式  */
  checkbox .wx-checkbox-input.wx-checkbox-input-checked {
    border: 1px solid #000;
    background-color: #fff;
  }

  /*checkbox选中后图标样式  */
  checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
    width: 28rpx;
    height: 28rpx;
    line-height: 28rpx;
    text-align: center;
    font-size: 22rpx;
    color: #000;
    background: transparent;
    transform: translate(-50%, -50%) scale(1);
    -webkit-transform: translate(-50%, -50%) scale(1);
  }

  // 协议弹框

  .popBg {
    background-color: rgba(0, 0, 0, 0.64);
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 10010000;

    .success-pop {
      border: 1px solid #eee;
      position: absolute;
      text-align: center;
      top: 45%;
      background: #fff;
      z-index: 10010001;
      margin-top: -90rpx;
      padding: 40rpx 15rpx;
      width: 500rpx;
      left: 50%;
      margin-left: -250rpx;

      .title1 {
        font-weight: bold;
        line-height: 24px;
        font-size: 24rpx;
        margin: 20rpx 12rpx;
        line-height: 40rpx;
        text-align: left;

        &.title-order {
          margin: 20rpx 0 20rpx 50rpx;
        }

        .text {
          font-weight: bold;
          font-size: 24rpx;
          line-height: 40rpx;
          letter-spacing: 2rpx;
        }
      }

      .title2 {
        padding-bottom: 24rpx;
      }
    }

    .icon-cuowu1 {
      position: absolute;
      right: 12rpx;
      top: 12rpx;
      font-size: 42rpx;
      font-weight: bold;
    }

    .btn-bg {
      display: flex;
      justify-content: center;

      .btnStyle {
        text-align: center;
        border: 1px solid #999999;
        -webkit-border-radius: 0;
        border-radius: 0;
        background-color: #fff;
        margin: 0rpx 18rpx;
        width: 220rpx;
        height: 68rpx;
        line-height: 68rpx;
        color: #000;
        font-size: 24rpx;
      }

      .btn2 {
        background-color: #CB171A;
        color: #fff;
        border: none;
      }

      .btn1 {
        line-height: 66rpx;
      }
    }
  }

  .type_green {
    width: 100%;
    text-align: center;
    height: 80rpx;
    background-color: #000000;
    font-size: 28rpx;
    color: #ffffff;
    padding: 4px 8px 4px 8px;
    border-radius: 24px 8px 24px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: NotoSansSC-Regular;
    font-weight: 500;
  }

  .tip_inner{
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
  }

  .tip_icon {
    width: 40rpx;
    height: 40rpx;
    text-align: center;
    flex-shrink: 0;
  }
  .tip_text{
    line-height: 40rpx;
  }

  .tip-text {
    display: block;
    margin: 37rpx 36rpx 0 36rpx;
    text-align: justify;
    font-size: 25rpx;
  }

  .tip-text2 {
    display: block;
    margin-left: 40rpx;
    text-align: justify;
    font-size: 25rpx;
    line-height: 40rpx;
  }

  .check-dec {
    font-family: FrankNew-Medium,NotoSansSC-Medium !important;
    color: #000000;
  }

  .imgText {
    position: relative;

    image {
      width: 100%;
      display: block;
    }

    .link1_1 {
      position: absolute;
      left: 40%;
      top: 50%;
      width: 60%;
      height: 9%;
    }

    .link1_2 {
      position: absolute;
      left: 0;
      top: 60%;
      width: 19%;
      height: 9%;
    }

    .link2_1 {
      position: absolute;
      left: 59%;
      top: 78%;
      width: 41%;
      height: 9%;
    }

    .link2_2 {
      position: absolute;
      left: 0;
      top: 88%;
      width: 28%;
      height: 9%;
    }
  }

  .mask-box-2 {
  	position: fixed;
  	left: 0;
  	top: 0;
  	width: 100%;
  	height: 100%;
  	z-index: 99;
  	background-color: rgba(0, 0, 0, 0.8);
  }
  .params-padding-box-3 {
  	overflow: hidden;
  	background: #FFFFFF;
  	position: absolute;
  	left: 48rpx;
  	width: 654rpx;
  	height: 796rpx;

  }
</style>
